package com.lxw.study.structural.facade.case2;

import java.util.ArrayList;
import java.util.List;

public class AlarmFacade implements AlarmComponent{
    private List<AlarmComponent> components = new ArrayList<>();

    public void addComponent(AlarmComponent component) {
        components.add(component);
    }

    @Override
    public String getAlarmMessage() {
        StringBuilder message = new StringBuilder();
        for (AlarmComponent component : components) {
            message.append(component.getAlarmMessage()).append("\n");
        }
        return message.toString();
    }
}
